package com.zyf.security.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyf.security.dao.UserDao;
import com.zyf.security.entities.User;
import com.zyf.security.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserService {
    @Resource
    UserDao userDao;
    public List<String> getRole(String username){
        return userDao.selectRoleByName(username);
    }
    public List<User> getAll() {
        return userDao.selectList(null);
    }
    public User getUser(String username){
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("username",username);
        return userDao.selectOne(queryWrapper);
    }
}
